﻿<UserControl x:Class="ShahyadS.BuildInspectorVSPackage.TFSBuildInspectorWPFUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:myApp="clr-namespace:ShahyadS.BuildInspectorVSPackage"
             mc:Ignorable="d" 
             d:DesignHeight="169" d:DesignWidth="859" UseLayoutRounding="True">
    <UserControl.Resources>
        <myApp:PropertyToImageConverter x:Key="PropertyToImageConverter" />
        <Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type GroupItem}" >
                        <Expander x:Name="exp" IsExpanded="true" Background="LightGray" Foreground="Black" >
                            <Expander.Header>
                                <TextBox Text="{Binding Name, Mode=OneWay}" BorderThickness="0" Background="LightGray"/>
                            </Expander.Header>
                            <ItemsPresenter/>
                        </Expander>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="66*" />
            <RowDefinition Height="245*" />
        </Grid.RowDefinitions>
        <TabControl HorizontalAlignment="Stretch" Name="tabControl1" VerticalAlignment="Stretch" Width="Auto" Grid.RowSpan="2">
            <TabItem Header="Inspect Builds" Name="BuildTabItem">
                <Grid>
                    <ToolBar Height="27" HorizontalAlignment="Stretch" Name="toolBar1" VerticalAlignment="Top" Width="Auto" >
                        <Button Height="22" HorizontalAlignment="Left" Margin="0,0,0,0" Name="RefreshAllButton" VerticalAlignment="Top" Width="22" Click="RefreshAllButton_Click">
                            <Image Name="RefreshAllImage" Height="Auto" HorizontalAlignment="Left" Margin="0" Stretch="None" VerticalAlignment="Top" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/RefreshAll.ico" />
                        </Button>
                        <Button Height="22" HorizontalAlignment="Left" Margin="0,0,0,0" Name="includeButton" VerticalAlignment="Top" Width="22" Click="includeButton_Click">
                            <Image Name="includeImage" Height="Auto" HorizontalAlignment="Left" Margin="0" Stretch="None" VerticalAlignment="Top" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/Include.ico" />
                        </Button>
                    </ToolBar>
                    <DataGrid Height="Auto" HorizontalAlignment="Stretch" Margin="0,27,0,0" Name="dataGrid1" VerticalAlignment="Stretch" Width="Auto" RowHeight="22" Grid.RowSpan="2" Background="Gray" AutoGenerateColumns="False" UseLayoutRounding="True" IsReadOnly="True" IsManipulationEnabled="False" IsTextSearchEnabled="True">
                        <DataGrid.ContextMenu>
                            <ContextMenu>
                                <MenuItem Name="findInTeamExplorerMenuItem" Header="Go to Team Explorer Build Node" Click="findInTeamExplorerMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/GotoBuildNode.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="openBuildExplorerMenuItem" Header="View Builds" Click="openBuildExplorerMenuItem_Click" />
                                <MenuItem Name="editBuildDefinitionMenuItem" Header="Edit Build Definition" Click="editBuildDefinitionMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/EditBuildDefinition.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="queueNewBuildMenuItem" Header="Queue New Build" Click="queueNewBuildMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/QueueNew.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="propertiesMenuItem" Header="Properties" Click="propertiesMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/properties.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="RefreshMenuItem" Header="Refresh" Click="RefreshMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/Refresh.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="selectallMenuItem" Header="Select All" Click="selectallMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/selectall.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="collapsAllMenuItem" Header="Collapse All" Click="collapsAllMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/Collapse.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="expandAllMenuItem" Header="Expand All" Click="expandAllMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/Expand.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="excludeMenuItem" Header="Exclude" Click="excludeMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/exclude.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="openLatestBuildDetailMenuItem" Header="Open Latest Build Detail" Click="openLatestBuildDetailMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/Open.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="openDropLocation" Header="Open Latest Build Drop Location" Click="openDropLocation_Click" />
                                <MenuItem Name="stopBuildMenuItem" Header="Stop Current Build" Click="stopBuildMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/Stopped.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Name="openCurrentBuildDetailMenuItem" Header="Open Current Build Detail" Click="openCurrentBuildDetailMenuItem_Click">
                                    <MenuItem.Icon>
                                        <Image Source="/BuildInspectorVSPackage;component/Images/OpenInprogress.ico" />
                                    </MenuItem.Icon>
                                </MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.GroupStyle>
                            <GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
                                <GroupStyle.Panel>
                                    <ItemsPanelTemplate>
                                        <DataGridRowsPresenter Background="Gray"/>
                                    </ItemsPanelTemplate>
                                </GroupStyle.Panel>
                            </GroupStyle>
                        </DataGrid.GroupStyle>
                        <DataGrid.Columns>
                            <DataGridTemplateColumn Header="Status" CanUserSort="True" CanUserReorder="True" SortMemberPath="Status" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="StatusHeaderImage" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="Fill" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/Status.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="StatusIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=Status, Path=Status, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="StatusIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn Header="TeamProject"
                                    Binding="{Binding TeamProject}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Name"
                                    Binding="{Binding Name}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Line"
                                    Binding="{Binding Line}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Extension"
                                    Binding="{Binding Extension}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTemplateColumn Header="LatestBuildRetention" CanUserSort="True" CanUserReorder="True" SortMemberPath="LatestBuildRetention" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="LatestBuildRetentionHeaderImage" ToolTip="Retention" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="None" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/Retention.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="LatestBuildRetentionIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=LatestBuildRetention, Path=LatestBuildRetention, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="LatestBuildRetentionIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="LatestBuildReason" CanUserSort="True" CanUserReorder="True" SortMemberPath="LatestBuildReason" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="LatestBuildReasonHeaderImage" ToolTip="Reason" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="None" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/Reason.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="LatestBuildReasonIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=LatestBuildReason, Path=LatestBuildReason, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="LatestBuildReasonIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="LatestBuildStatus" CanUserSort="True" CanUserReorder="True" SortMemberPath="LatestBuildStatus" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="LatestBuildStatusHeaderImage" ToolTip="Latest Build Status" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="None" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/status.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="LatestBuildStatusIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=LatestBuildStatus, Path=LatestBuildStatus, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="LatestBuildStatusIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="LatestBuildIsUpdated" CanUserSort="True" CanUserReorder="True" SortMemberPath="LatestBuildIsUpdated" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="LatestBuildIsUpdatedHeaderImage" ToolTip="Update Status of Latest Build" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="None" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/Updated.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="LatestBuildIsUpdatedIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=LatestBuildIsUpdated, Path=LatestBuildIsUpdated, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="LatestBuildIsUpdatedIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn Header="Latest Build Name"
                                    Binding="{Binding LatestBuildName}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTemplateColumn Header="LatestGoodBuildIsUpdated" CanUserSort="True" CanUserReorder="True" SortMemberPath="LatestGoodBuildIsUpdated" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="LatestGoodBuildIsUpdatedHeaderImage" ToolTip="Update Status of Latest Good Build" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="None" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/Updated.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="LatestGoodBuildIsUpdatedIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=LatestGoodBuildIsUpdated, Path=LatestGoodBuildIsUpdated, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="LatestGoodBuildIsUpdatedIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="LatestGoodBuildIsIntegrated" CanUserSort="True" CanUserReorder="True" SortMemberPath="LatestGoodBuildIsIntegrated" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="LatestGoodBuildIsIntegratedHeaderImage" ToolTip="Integration Status" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="None" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/IntegrationStatus.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="LatestGoodBuildIsIntegratedIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=LatestGoodBuildIsIntegrated, Path=LatestGoodBuildIsIntegrated, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="LatestGoodBuildIsIntegratedIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn Header="Latest Good Build Name"
                                    Binding="{Binding LatestGoodBuildName}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTemplateColumn Header="CurrentBuildStatus" CanUserSort="True" CanUserReorder="True" SortMemberPath="CurrentBuildStatus" Width="Auto" >
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Image Name="CurrentBuildStatusHeaderImage" ToolTip="Currently Queued Build Status" Height="Auto" HorizontalAlignment="Center" Margin="0" Stretch="None" VerticalAlignment="Center" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/CurrentStatus.ico" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Image ToolTip="a" Name="CurrentBuildStatusIcon" Source="{Binding Converter={StaticResource PropertyToImageConverter}, ConverterParameter=CurrentBuildStatus, Path=CurrentBuildStatus, UpdateSourceTrigger=PropertyChanged }" Margin="0" Width="Auto" Height="Auto" Stretch="None" ToolTipOpening="CurrentBuildStatusIcon_ToolTipOpening" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn Header="Controller Name"
                                    Binding="{Binding ControllerName}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Agent Name"
                                    Binding="{Binding AgentName}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
            <TabItem Header="Inspect Agents" Name="AgentTabItem">
                <Grid>
                    <ToolBar Height="27" HorizontalAlignment="Stretch" Name="toolBar2" VerticalAlignment="Top" Width="Auto" >
                        <Button Height="22" HorizontalAlignment="Left" Margin="0,0,0,0" Name="RefreshAllAgentsButton" VerticalAlignment="Top" Width="22" Click="RefreshAllAgentsButton_Click">
                            <Image Name="RefreshAllAgentsImage" Height="Auto" HorizontalAlignment="Left" Margin="0" Stretch="None" VerticalAlignment="Top" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/RefreshAll.ico" />
                        </Button>
                        <Button Height="22" HorizontalAlignment="Left" Margin="0,0,0,0" Name="ManageControllerButton" VerticalAlignment="Top" Width="22" Click="ManageControllerButton_Click">
                            <Image Name="ManageControllerImage" Height="Auto" HorizontalAlignment="Left" Margin="0" Stretch="None" VerticalAlignment="Top" Width="Auto" Source="/BuildInspectorVSPackage;component/Images/ManageController.ico" />
                        </Button>
                    </ToolBar>
                    <DataGrid Height="Auto" HorizontalAlignment="Stretch" Margin="0,27,0,0" Name="dataGrid2" VerticalAlignment="Stretch" Width="Auto" RowHeight="22" Grid.RowSpan="2" Background="Gray" AutoGenerateColumns="False" UseLayoutRounding="True" IsReadOnly="True" IsManipulationEnabled="False" IsTextSearchEnabled="True">
                        <DataGrid.GroupStyle>
                            <GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
                                <GroupStyle.Panel>
                                    <ItemsPanelTemplate>
                                        <DataGridRowsPresenter Background="Gray"/>
                                    </ItemsPanelTemplate>
                                </GroupStyle.Panel>
                            </GroupStyle>
                        </DataGrid.GroupStyle>
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Name"
                                    Binding="{Binding Name}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Machine Name"
                                    Binding="{Binding MachineName}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Controller Name"
                                    Binding="{Binding ControllerName}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Build Uri"
                                    Binding="{Binding BuildUri}"
                                    Width="Auto" >
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>
